package com.haibo.controller;

import com.alibaba.fastjson2.JSON;
import com.haibo.entity.dto.MedicalRecordGenerationDTO;
import com.haibo.entity.dto.ThreeLevelCardControlReminderDTO;
import com.haibo.result.R;
import com.haibo.service.impl.ElectronicMedicalRecordServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author : 刘海波
 * @Date: 2025-09-22 8:05
 * @Description: 【电子病历回写】
 */
@Slf4j
@RequestMapping("/api/v1")
@RestController
public class ElectronicMedicalRecordRewriteController {

    @Autowired
    private ElectronicMedicalRecordServiceImpl electronicMedicalRecordService;

    /**
     * 病历质控-回写病历内容至中间表
     * @param param
     * @return
     */
    @PostMapping("/middle/medical/save")
    public R rewriteMedicalRecordQualityControlData(@RequestBody MedicalRecordGenerationDTO param) {
        log.debug("[病历质控-回写病历内容至中间表]param json:{}", JSON.toJSONString(param));

        return electronicMedicalRecordService.rewriteMedicalRecordQualityControlData(param);
    }

    /**
     * 三级卡控-回写提醒消息至中间表
     * @param param
     * @return
     */
    @PostMapping("/middle/medical-record/qc/message/sync")
    public R rewriteThreeLevelCardControlReminderData(@RequestBody ThreeLevelCardControlReminderDTO param) {
        log.debug("[三级卡控-回写提醒消息至中间表]param json:{}", JSON.toJSONString(param));

        return electronicMedicalRecordService.rewriteThreeLevelCardControlReminderData(param);
    }

}
